import request from '@/utils/api';

export function addRoom(data) {
  return request({
    url: '/addRoom',
    method: 'post',
    data,
  });
}

export function editRoom(data) {
  return request({
    url: `/editRoom`,
    method: 'post',
    data,
  });
}

export function addDevice(data) {
  return request({
    url: `/addDevice`,
    method: 'post',
    data,
  });
}

export function saveInspection(data) {
  return request({
    url: `/saveInspection`,
    method: 'post',
    data,
  });
}

export function addInspection(data) {
  return request({
    url: `/addInspection`,
    method: 'post',
    data,
  });
}

export function searchInspections(data) {
  return request({
    url: `/searchInspections`,
    method: 'get',
    params: data,
  });
}

export function getInspectionForm(data) {
  return request({
    url: `/getInspectionForm/${data.id}`,
    method: 'get',
  });
}

export function editInspection(data) {
  return request({
    url: `/editInspection`,
    method: 'post',
    data,
  });
}

export function exceptionDevices(data) {
  return request({
    url: `/exceptionDevices/${data.inspection_id}/${data.device_status}`,
    method: 'get',
  });
}

export function deleteInspection(data) {
  return request({
    url: `/deleteInspection`,
    method: 'post',
    data,
  });
}

export function exportInspectionData(data) {
  return request({
    url: `/exportInspectionData/${data.inspection_id}/${data.device_status}`,
    method: 'get',
    responseType: 'blob',
  });
}
